const fs = require('fs')
const babel = require('@babel/core')
const traverse = require('@babel/traverse').default
const gen = require('@babel/generator').default


// 读取source.js内容
let source = fs.readFileSync('./source.js')

// 使用babel.parse方法
babel.parse(source, (err, ast) => {
    let indent = ''

    traverse(ast, {})

    console.log(gen(ast).code)
})